import types
import logging.config
import config_default

_start_list=[]
_end_list=[]


def add_app_start_fun(fun):
	if type(fun) == types.FunctionType:
		_start_list.append(fun)


def add_app_exit_fun(fun):
	if type(fun) == types.FunctionType:
		_end_list.append(fun)

def app_start():
	#init logging
	logging.config.dictConfig(config_default.configs['log'])
	for fun in _start_list:
		fun()


# 退出时执行
def app_exit_befor():
	for fun in _end_list:
		fun()
